<?php
require_once(dirname(__FILE__)."./../comm/config.php");

class qq_login
{
	function qq($appid, $scope, $callback)
	{
	    $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
	    $login_url = "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=" 
	        . $appid . "&redirect_uri=" . urlencode($callback)
	        . "&state=" . $_SESSION['state']
	        . "&scope=".$scope;

	    header("Location:$login_url");
	}
}
?>
